﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>修剪 / 左修剪 / 右修剪 - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The 修剪, 左修剪 and 右修剪 functions 修剪 characters from the beginning and/or end of a 字符串." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>修剪</h1>

<p>移除字符串开头和/或末尾的某些字符.</p>

<pre class="Syntax">Result :=  <span class="func">修剪</span>(字符串 <span class="optional">, OmitChars := " `t"</span>)
Result := <span class="func">左修剪</span>(字符串 <span class="optional">, OmitChars := " `t"</span>)
Result := <span class="func">右修剪</span>(字符串 <span class="optional">, OmitChars := " `t"</span>)</pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>字符串</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>任何字符串值或变量. 不支持数字.</p>
  </dd>

  <dt>OmitChars</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>可选的字符列表(区分大小写), 在 <em>字符串</em> 的开头和/或末尾处移除这些字符. 如果省略, 则移除空格和 tab.</p>
  </dd>

</dl>

<h2 id="Return_Value">返回值</h2>
<p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
<p>这些函数返回指定字符串修剪后的版本.</p>

<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>text := "  text  "
信息框
(
    "No 修剪:`t'" text "'
    修剪:`t'" 修剪(text) "'
    左修剪:`t'" 左修剪(text) "'
    右修剪:`t'" 右修剪(text) "'"
)
信息框 左修剪("00000123", "0")</pre>
</div>

</body>
</html>